package com.gs.api.weixin.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gs.api.weixin.dao.WxUserDao;
import com.gs.api.weixin.entity.WxUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @author guoyunfei on 2021/7/10 15:29
 * @className WxUserService
 * @description TODO
 * @Version 1.0
 */
@Service
@Transactional(readOnly = true)
public class WxUserService extends ServiceImpl<WxUserDao,WxUser> {

    @Autowired
    private WxUserDao wxUserDao;

    @Transactional
    public int insert(WxUser wxUser){
        wxUser.setRegTime(new Date());
        wxUser.setLastLoginTime(new Date());
        return wxUserDao.insert(wxUser);
    }

    @Transactional
    public int update(WxUser wxUser){
        wxUser.setLastLoginTime(new Date());
        return wxUserDao.updateWxUser(wxUser);
    }



}
